﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using QuizService.beans;
using System.Diagnostics;
using System.Data.OleDb;

namespace QuizService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class QuizService : IQuizService
    {
        dao.dao db = new dao.dao();

        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public bool RegisterUser(user r)
        {
            return db.RegisterUser(r);   
        }
 
        public bool LogInUser(user r)
        {
            return db.LogInUser(r);
        }

        public question getRandomQuestion(genre g)
        {
            return db.getRandomQuestion(g);
        }

        //Test
        public bool addQuestion(question q)
        {
            return db.addQuestion(q);
        }

        //test
        public bool delQuestion(question q)
        {
            return db.delQuestion(q);
        }

        //test
        public IEnumerable<question> getAllQuestions(genre g)
        {
            return db.getAllQuestions(g);
        }

        //test
        public user getSender(int id)
        {
            return db.getSender(id);
        }

        //test
        public genre getGenre(int id)
        {
            return db.getGenre(id);
        }

        //test
        public bool modifyQuestion(question q)
        {
            return db.modifyQuestion(q);
        }
        //test
        public bool isAdmin(user r)
        {
            return db.isAdmin(r);
        }

        public bool doAdmin(user r)
        {
            return db.doAdmin(r);
        }

        public bool delAdmin(user r)
        {
            return db.delAdmin(r);
        }

        public bool delUser(user r)
        {
            return db.delUser(r);
        }
        //test
        public bool addGenre(genre g)
        {
            return db.addGenre(g);
        }
        //test
        public bool modifyGenre(genre g)
        {
            return db.modifyGenre(g);
        }
        //test
        public bool delGenre(genre g)
        {
            return db.delGenre(g);
        }

        //teszt
        public bool addMatch(match m)
        {
            return db.addMatch(m);
        }

        //test
        public double countPoints(user r)
        {
            return db.CountPoints(r);
        }
        //test
        public int countPlayedQuestions(user r)
        {
            return db.CountPlayedQuestions(r);
        }
        //test
        public IEnumerable<toplist> getToplist()
        {
            return db.getToplist();
        }

        //test
        public bool delMatch(match m)
        {
            return db.delMatch(m);
        }
        //test
        public IEnumerable<genre> getAllGenres()
        {
            return db.getAllGenres();
        }

        //test
        public IEnumerable<match> getAllMatches()
        {
            return db.getAllMatches();
        }
        //test
        public IEnumerable<match> getuserAllMatches(user r)
        {
            return db.getAlluserMatches(r);
        }
        //test
        public IEnumerable<user> getAllUsers()
        {
            return db.getAllUsers();
        }
        //test
        public question getQuestionbyId(int id)
        {
            return db.getQuestionById(id);
        }
        //test
        public match getMatchbyId(int id)
        {
            return db.getMatchById(id);
        }


        public bool ModifyUser(user u)
        {
            return db.modifyUser(u);
        }
    }
}
